package com.AAA.service.Impl.sds;

import com.AAA.entity.MyPage;
import com.AAA.entity.sds.TSdsPlane;
import com.AAA.service.sds.TSdsPlaneService;
import com.AAA.dao.sds.TSdsPlaneMapper;


import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * (TSdsPlane)表服务实现类
 *
 * @author makejava
 * @since 2022-10-28 16:14:00
 */
@Service
public class TSdsPlaneServiceImpl implements TSdsPlaneService {
   @Autowired
   private TSdsPlaneMapper mapper;
   //分页查询
   @Override
   public PageInfo query(MyPage myPage, TSdsPlane tSdsPlane) {
         PageHelper.startPage(myPage.getPage(),myPage.getLimit());
         List<TSdsPlane> tSds = mapper.queryall(tSdsPlane);
         PageInfo pageInfo = new PageInfo(tSds);
         return pageInfo;
   }
   //添加
    @Override
    public boolean add(TSdsPlane tSds) {
        int insert = mapper.insert(tSds);
        if (insert>0){
            return true;
        }
        return false;
    }
    //修改
    @Override
    public boolean edit(TSdsPlane tSds) {
        int insert=mapper.updateByPrimaryKeySelective(tSds);
        if(insert>0){
            return true;
        }
        return false;
    }
    //开关修改
    @Override
    public boolean updatas(TSdsPlane tSdsPlane) {
        //根据id修改状态
        int i = mapper.updateByPrimaryKeySelective(tSdsPlane);
        return i>0?true:false;
    }




    @Override
    public TSdsPlane queryByQyCode(TSdsPlane tSdsPlane) {
        TSdsPlane tSdsPlane1 = mapper.selectOne(tSdsPlane);
        return tSdsPlane1;
    }

}
